﻿<%@ Page Title="" Language="C#" MasterPageFile="~/masterPage/admin/Supplier.master"
    AutoEventWireup="true" CodeFile="SupplierInquery.aspx.cs" Inherits="Trade_Events_event_list" %>

<%@ MasterType VirtualPath="~/masterPage/admin/Supplier.master" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">

    <telerik:RadAjaxLoadingPanel runat="server" ID="RadAjaxLoadingPanel1">
    </telerik:RadAjaxLoadingPanel>    
    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="rpbNavigator">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="rpbNavigator"></telerik:AjaxUpdatedControl>
                    <telerik:AjaxUpdatedControl ControlID="radGridMainlist" LoadingPanelID="RadAjaxLoadingPanel1">
                    </telerik:AjaxUpdatedControl>
                </UpdatedControls>
            </telerik:AjaxSetting>
            <telerik:AjaxSetting AjaxControlID="radGridMainlist">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="radGridMainlist"></telerik:AjaxUpdatedControl>
                    <telerik:AjaxUpdatedControl ControlID="rpbNavigator" LoadingPanelID="RadAjaxLoadingPanel1">
                    </telerik:AjaxUpdatedControl>
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManager>

    <telerik:RadDockLayout ID="RadDockLayout1" runat="server">
        <table>
            <tr>
                <td valign="top">
                    <telerik:RadPanelBar runat="server" ID="rpbNavigator" ExpandMode="MultipleExpandedItems"
                        Width="220" OnItemClick="rpbNavigator_ItemClick">
                        <Items>
                            <telerik:RadPanelItem Text="询价单" Expanded="True" PostBack="false">
                                <Items>
                                    <telerik:RadPanelItem Text="全部询盘 qbxp(qbwd未读)" Value="All" Selected="true" />
                                    <telerik:RadPanelItem Text="专属询盘 zsxp(zswd未读)" Value="Specific" />
                                    <telerik:RadPanelItem Text="重要询盘 zyxp" Value="Important" />
                                    <telerik:RadPanelItem Text="待报价询盘 dbjxp" Value="Unquote" />
                                    <telerik:RadPanelItem Text="待授盘的询盘 dspxp" Value="UnGrant" />
                                    <telerik:RadPanelItem Text="待评价的询盘 dpjxp" Value="Uncomment" />
                                </Items>
                            </telerik:RadPanelItem>
                            <telerik:RadPanelItem Text="重要商机" Expanded="True" PostBack="false">
                                <Items>
                                    <telerik:RadPanelItem Text="今日到期询盘 jrdqxp" Value="ExpiredToday" />
                                    <telerik:RadPanelItem Text="明日到期询盘 mrdqxp" Value="ExpiredTomm" />
                                </Items>
                            </telerik:RadPanelItem>
                            <telerik:RadPanelItem Text="历史业务" Expanded="True" PostBack="false">
                                <Items>
                                    <telerik:RadPanelItem Text="已报价的询盘 fssybj" Value="QuoteSent" />
                                    <telerik:RadPanelItem Text="已授盘的询盘 cgsybj" Value="Granted" />
                                    <telerik:RadPanelItem Text="交易成功的询盘 jycgxp" Value="Successful" />
                                </Items>
                            </telerik:RadPanelItem>
                            <telerik:RadPanelItem Text="保存的有效询盘" Expanded="True" PostBack="false">
                                <ContentTemplate>
                                    <asp:GridView ID="gvFilterList" runat="server" DataSourceID="sdsFilterList" AutoGenerateColumns="False"
                                        DataKeyNames="InquiryFilterID" OnRowDataBound="gvFilterList_RowDataBound">
                                        <RowStyle HorizontalAlign="Center" />
                                        <SelectedRowStyle BackColor="#a7d2e9" />
                                        <Columns>
                                            <asp:BoundField DataField="InquiryFilterID" HeaderText="ID" ReadOnly="True" Visible="False" />
                                            <asp:BoundField DataField="FilterName" HeaderText="保存检索条件">
                                                <HeaderStyle HorizontalAlign="Center" Width="65px" Wrap="False" />
                                            </asp:BoundField>
                                            <asp:BoundField DataField="XPNewCnt" HeaderText="新询盘">
                                                <HeaderStyle HorizontalAlign="Center" Width="50px" Wrap="False" />
                                            </asp:BoundField>
                                            <asp:BoundField DataField="XPAllCnt" HeaderText="全部询盘">
                                                <HeaderStyle HorizontalAlign="Center" Width="50px" Wrap="False" />
                                            </asp:BoundField>
                                            <asp:CommandField ShowEditButton="True" EditText="编辑" />
                                        </Columns>
                                    </asp:GridView>
                                </ContentTemplate>
                            </telerik:RadPanelItem>
                            
                        </Items>
                    </telerik:RadPanelBar>
                </td>
                <td valign="top" width="700">
                    <telerik:RadDockZone ID="rdzContent" runat="server" BorderStyle="None">
                        <telerik:RadDock ID="rdContent" runat="server" Height="600" Title="我的询盘单" CloseText="关闭"
                            CollapseText="收起" DefaultCommands="None" DockMode="Docked" ExpandText="展开" EnableRoundedCorners="true"
                            Collapsed="false" Resizable="false" Pinned="true" Width="600px" EnableDrag="false">
                            <ContentTemplate>
                                <telerik:RadGrid ID="radGridMainlist" AllowPaging="True" AllowSorting="True" DataSourceID="sdsEventsList"
                                    runat="server" AllowFilteringByColumn="false" AutoGenerateColumns="False" AllowMultiRowSelection="true"
                                    OnItemCommand="radGridMainlist_ItemCommand">
                                    <PagerStyle FirstPageToolTip="首页" ShowPagerText="false" PagerTextFormat="{4}  当前{0}/{1}页, 条目({2}-{3})/{5}"
                                        NextPagesToolTip="下页" Mode="NextPrevAndNumeric" PageSizeLabelText="单页数目" PrevPageToolTip="上页"
                                        LastPageToolTip="末页" />
                                    <MasterTableView DataKeyNames="EventID, Importance, IsFlagged, EventStatus" ShowHeadersWhenNoRecords="true"
                                        NoMasterRecordsText="无询盘信息">
                                        <Columns>
                                            <telerik:GridClientSelectColumn Reorderable="False" UniqueName="ClientSelectColumn">
                                                <HeaderStyle Width="30px"></HeaderStyle>
                                            </telerik:GridClientSelectColumn>
                                            <telerik:GridTemplateColumn UniqueName="ImportanceColumn" Groupable="False" HeaderText="重要">
                                                <HeaderStyle Width="30px"></HeaderStyle>
                                                <ItemStyle Height="35px"></ItemStyle>
                                                <ItemTemplate>
                                                    <asp:ImageButton ID="ImportantImage" BorderWidth="0px" CommandName="ChangeImportance"
                                                        ImageUrl='<%# Convert.ToBoolean(DataBinder.Eval(Container.DataItem, "Importance"))? "~/images/backImg/Important_transparent.gif" :"~/images/backImg/Important_grey.gif" %>'
                                                        AlternateText="重要性" Style="cursor: pointer;" ToolTip='<%# Convert.ToBoolean(DataBinder.Eval(Container.DataItem, "Importance"))? "点击更改为不重要": "点击更改为重要" %>'
                                                        runat="server"></asp:ImageButton>
                                                </ItemTemplate>
                                            </telerik:GridTemplateColumn>
                                            <telerik:GridTemplateColumn UniqueName="IsFlaggedColumn" Groupable="False" HeaderText="待报价">
                                                <HeaderStyle Width="40px"></HeaderStyle>
                                                <ItemStyle Height="35px"></ItemStyle>
                                                <ItemTemplate>
                                                    <asp:ImageButton ID="FlagImageButton" BorderWidth="0px" CommandName="ChangeFlag"
                                                        ImageUrl='<%# Convert.ToBoolean(DataBinder.Eval(Container.DataItem, "IsFlagged"))? "~/images/backImg/FlagRed.png": "~/images/backImg/Flag.png" %>'
                                                        AlternateText="标记待报价" Style="cursor: pointer;" ToolTip='<%# Convert.ToBoolean(DataBinder.Eval(Container.DataItem, "IsFlagged"))? "点击更改为报价": "点击更改为待报价" %>'
                                                        runat="server"></asp:ImageButton>
                                                </ItemTemplate>
                                            </telerik:GridTemplateColumn>
                                            <telerik:GridBoundColumn UniqueName="PartInfo" SortExpression="PartInfo" HeaderText="零件信息"
                                                DataField="PartInfo">
                                                <HeaderStyle Width="80px"></HeaderStyle>
                                            </telerik:GridBoundColumn>
                                            <telerik:GridBoundColumn UniqueName="Quantity" SortExpression="Quantity" HeaderText="采购数量"
                                                DataField="Quantity">
                                                <HeaderStyle Width="80px"></HeaderStyle>
                                            </telerik:GridBoundColumn>
                                            <telerik:GridBoundColumn UniqueName="Category" SortExpression="Category" HeaderText="工艺/零部件类别"
                                                DataField="Category">
                                                <HeaderStyle Width="100px"></HeaderStyle>
                                            </telerik:GridBoundColumn>
                                            <telerik:GridBoundColumn UniqueName="ExpireDate" SortExpression="ExpireDate" HeaderText="有效期限"
                                                DataField="ExpireDate" DataFormatString="{0:d}">
                                                <HeaderStyle Width="125px"></HeaderStyle>
                                            </telerik:GridBoundColumn>
                                            <telerik:GridTemplateColumn UniqueName="EventStatus" Groupable="False" HeaderText="信息状态">
                                                <HeaderStyle Width="75px"></HeaderStyle>
                                                <ItemStyle Height="35px"></ItemStyle>
                                                <ItemTemplate>
                                                    <asp:Literal ID="ltlEventStatus" Text='<%# (DataBinder.Eval(Container.DataItem, "EventStatus").ToString().StartsWith("0"))? "未读": "已读" %>'
                                                        runat="server"></asp:Literal>
                                                </ItemTemplate>
                                            </telerik:GridTemplateColumn>
                                            <telerik:GridTemplateColumn UniqueName="ViewDetails" Groupable="False">
                                                <HeaderStyle Width="50px"></HeaderStyle>
                                                <ItemStyle Height="35px"></ItemStyle>
                                                <ItemTemplate>
                                                    <asp:LinkButton ID="lbtViewDetails" runat="server" ToolTip="点击查看询盘详情" CausesValidation="false"
                                                        Text="查看" CommandName="viewdetails" CommandArgument="~/Trade/Supplier/SupplierItem.aspx" />
                                                </ItemTemplate>
                                            </telerik:GridTemplateColumn>
                                        </Columns>
                                    </MasterTableView>
                                    <ClientSettings>
                                        <Selecting AllowRowSelect="true" EnableDragToSelectRows="false" UseClientSelectColumnOnly="true" />
                                    </ClientSettings>
                                </telerik:RadGrid>
                            </ContentTemplate>
                        </telerik:RadDock>
                    </telerik:RadDockZone>
                </td>
            </tr>
        </table>
    </telerik:RadDockLayout>
    <asp:SqlDataSource ID="sdsEventsList" runat="server" ConnectionString="<%$ ConnectionStrings:XunPanConnectionString %>"
        SelectCommand="SELECT * FROM [vw_XPInquiryEvent] WHERE [VendorCompanyID] = @VendorCompanyID AND [InquiryStatus] LIKE '__1%'"
         FilterExpression="{0}" >
        <FilterParameters>
            <asp:Parameter Name="Filter1" Type="String" />
        </FilterParameters>
        <SelectParameters>
            <asp:Parameter Name="VendorCompanyID" DbType="Guid" />
        </SelectParameters>
    </asp:SqlDataSource>
    <asp:SqlDataSource ID="sdsFilterList" runat="server" ConnectionString="<%$ ConnectionStrings:XunPanConnectionString %>"
        SelectCommand="SELECT * FROM [XPInquiryFilter] WHERE ([CompanyID] = @CompanyID)">
        <SelectParameters>
            <asp:Parameter Name="CompanyID" DbType="Guid" />
        </SelectParameters>
    </asp:SqlDataSource>
    <asp:SqlDataSource ID="sdsUpdateEventFlag" runat="server" ConnectionString="<%$ ConnectionStrings:XunPanConnectionString %>"
        UpdateCommand="UPDATE [XPInquiryEvent] SET [Importance] = @Importance, [IsFlagged] = @IsFlagged WHERE [EventID] = @EventID">
        <UpdateParameters>
            <asp:Parameter Name="EventID" DbType="Guid" />
            <asp:Parameter Name="Importance" DbType="Int32" />
            <asp:Parameter Name="IsFlagged" DbType="Boolean" />
        </UpdateParameters>
    </asp:SqlDataSource>
</asp:Content>
